package hxy.bytecode.queue;

import java.util.concurrent.LinkedBlockingDeque;

public class Test {

    public static void main(String[] args) {
        LinkedBlockingDeque<String> queue = new LinkedBlockingDeque<>(1000);
        Produce produce = new Produce(1, queue);
        new Consumer(queue, 1);
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (int i = 0; i < 20; i++) {
            if (i > 10) {
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            produce.produce("@" + i + "@");
        }
    }
}